/*
@filename: initPlayerLocal.sqf
Author:
	
	Quiksilver

Last modified:

	12/05/2014
	
Description:

	Client scripts and event handlers.
	
______________________________________________________*/

for [ {_i = 0}, {_i < count(paramsArray)}, {_i = _i + 1} ] do {
	call compile format
	[
		"PARAMS_%1 = %2",
		(configName ((missionConfigFile >> "Params") select _i)),
		(paramsArray select _i)
	];
};


enableSentences false;
enableTeamswitch false;													

// Initialise GET/SET Loadout functions
getLoadout = compile preprocessFileLineNumbers "scripts\loadouts\get_loadout.sqf";
setLoadout = compile preprocessFileLineNumbers "scripts\loadouts\set_loadout.sqf";
loadout = [player] call getLoadout;

// No firing in the base
//player addeventhandler ["fired",{  if (vehicle (_this select 0) in list base ) then {deleteVehicle (_this select 6)};}];

//------------------- client executions

TCB_AIS_PATH = "scripts\ais_injury\";
_null = [] execVM "scripts\stats\init_pointsLoop.sqf";							// Give points for playing on the server
_null = [] execVM "scripts\arsenal\initArsenal.sqf";							// Virtual Arsenal
_null = [] execvm "scripts\vehicle\crew\crew.sqf"; 								// vehicle HUD
_null = [] execVM 'scripts\group_manager.sqf';									// group manager
_null = [] execVM "scripts\restrictions.sqf"; 									// gear restrictions
//_null = [] execVM "scripts\pilotCheck.sqf"; 									// pilots only
_null = [] execVM "scripts\misc\diary.sqf";										// diary tabs
_null = [] execVM "scripts\vehicle\fastrope\zlt_fastrope.sqf";					// heli rope	
_null = [] execVM "scripts\misc\fatigue.sqf";									// Quick fatigue recovery when resting
_null = [] execVM "scripts\admin\init_diary.sqf";								// Initialise admin menus
if (PARAMS_PlayerMarkers == 1) then {
	_null = [] execVM "scripts\playerMarkers.sqf";								// blufor map tracker
};
if (!isServer) then {
	_null = [] execVM "scripts\real_weather.sqf";								// Real Weather (Don't run twice on listen servers)
};	
//-------------------- PVEHs

"showNotification" addPublicVariableEventHandler
{
	private ["_type", "_message"];
	_array = _this select 1;
	_type = _array select 0;
	_message = "";
	if (count _array > 1) then { _message = _array select 1; };
	[_type, [_message]] call BIS_fnc_showNotification;
};

"GlobalHint" addPublicVariableEventHandler
{
	private ["_GHint"];
	_GHint = _this select 1;
	hint parseText format["%1", _GHint];
};

"hqSideChat" addPublicVariableEventHandler
{
	_message = _this select 1;
	[WEST,"HQ"] sideChat _message;
};

"addToScore" addPublicVariableEventHandler
{
	((_this select 1) select 0) addScore ((_this select 1) select 1);
};

"radioTower" addPublicVariableEventHandler
{
	"radioMarker" setMarkerPosLocal (markerPos "radioMarker");
	"radioMarker" setMarkerTextLocal (markerText "radioMarker");
	"radioCircle" setMarkerPosLocal (markerPos "radioCircle");
};

"sideMarker" addPublicVariableEventHandler
{
	"sideMarker" setMarkerPosLocal (markerPos "sideMarker");
	"sideCircle" setMarkerPosLocal (markerPos "sideCircle");
	"sideMarker" setMarkerTextLocal format["Side Mission: %1",sideMarkerText];
};

"priorityMarker" addPublicVariableEventHandler
{
	"priorityMarker" setMarkerPosLocal (markerPos "priorityMarker");
	"priorityCircle" setMarkerPosLocal (markerPos "priorityCircle");
	"priorityMarker" setMarkerTextLocal format["Priority Target: %1",priorityTargetText];
};